home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / include / grtextarray.h < prev    next >
C/C++ Source or Header  |  1997-05-08  |  3KB  |  101 lines

  1. /*
  2. |    file name -- GRtextarray.h
  3. |===================================================================
  4. |
  5. |    copyright (c) 1988, V.I. corporation
  6. |
  7. |    GRtextarray - Include for using GRtextarray
  8. |
  9. |    alan c morse      9 Nov 88
  10. |
  11. |===================================================================
  12. */
  13. #ifndef    _GRTEXTARRAY_H_
  14. #define    _GRTEXTARRAY_H_
  15.  
  16. /* Data structures */
  17. typedef struct CHAR_CELL
  18.   { char color, c; } CHAR_CELL;
  19.  
  20. typedef struct CHAR_POSITION
  21.   { short row, col; } CHAR_POSITION;
  22.  
  23. typedef struct CHAR_RECT
  24.   { CHAR_POSITION ul, lr; } CHAR_RECT;
  25.  
  26. /* -- macros for processing a CHAR_RECT --- */
  27. #define CRWIDTH(a) ((a)->lr.col - (a)->ul.col + 1)
  28. #define CRHEIGHT(a) ((a)->lr.row - (a)->ul.row + 1)
  29. #define CRASSIGN(a, ulrow, ulcol, lrrow, lrcol ) \
  30.   ((a)->ul.row = ulrow, (a)->ul.col = ulcol, \
  31.    (a)->lr.row = lrrow, (a)->lr.col = lrcol )
  32. #define CRCOPY(dst,src) \
  33.   ((dst)->ul.row = (src)->ul.row, (dst)->ul.col = (src)->ul.col, \
  34.    (dst)->lr.row = (src)->lr.row, (dst)->lr.col = (src)->lr.col )
  35.  
  36. #define TA_NUM_COLORS 8
  37.  
  38. /* Define directions for sliding text */
  39. #define SLIDE_RIGHT    1
  40. #define SLIDE_UP    2
  41. #define SLIDE_LEFT    3
  42. #define SLIDE_DOWN    4
  43.  
  44. /* -- macros for packing and unpacking character color attributes --- */
  45. #define PACK_COLOR( fore, back ) (((fore & 0x7)<<4)|(back & 0x7))
  46. #define UNPACK_COLOR( color, fore, back ) \
  47.   ( fore = (((unsigned int)color)>>4) & 0x7, back = color & 0x7 )
  48.  
  49. /* prepacked text colors */
  50. #define    A_NORMAL    0x10
  51. #define    A_INVERSE    0x01
  52.  
  53. /* Macro to write only one character */
  54. #define    GRtaWriteChar( ta, row, col, ncols, c, color )    \
  55.              {            \
  56.              int n = ncols;    \
  57.              char s[2];        \
  58.              s[0] = c;        \
  59.              s[1] = '\0';    \
  60.              while( n-- > 0 )    \
  61.                (VOID)GRtaWrite( ta, row, col+n, 1, s, color );\
  62.              }
  63.  
  64. /* Flags to use to specify method of text array creation
  65. |  (These flags are or'd together and used as the spec flag)
  66. */
  67.  
  68. /* Where point is fixed */
  69. #define    PF_BITS        0x0F    /* bits defining where point is fixed */
  70. #define    PF_TOP        0x01    /* top */
  71. #define    PF_BOTTOM    0x02    /* bottom */
  72. #define    PF_LEFT        0x04    /* left */
  73. #define    PF_RIGHT    0x08    /* right */
  74. #define    PF_VERT_CNTRD    (PF_TOP|PF_BOTTOM)    /* top/bottom cntrd */
  75. #define    PF_HORIZ_CNTRD    (PF_LEFT|PF_RIGHT)    /* left/right cntrd */
  76. #define    PF_LL        (PF_BOTTOM|PF_LEFT)    /* lower left */
  77. #define    PF_LR        (PF_BOTTOM|PF_RIGHT)    /* lower right */
  78. #define    PF_UL        (PF_TOP|PF_LEFT)    /* upper left */
  79. #define    PF_UR        (PF_TOP|PF_RIGHT)    /* upper right */
  80. #define    PF_CENTERED    (PF_VERT_CNTRD|PF_HORIZ_CNTRD)    /* centered */
  81.  
  82. /* How to resolve size when both screen and char coords are specified */
  83. #define    RSLVE_BITS    0x30    /* bits defining how to resolve size */
  84. #define    RSLVE_X_GREATER    0x10    /* take the greater of two in x dir */
  85. #define    RSLVE_Y_GREATER    0x20    /* take the greater of two in y dir */
  86. #define    RSLVE_X_LESSER    0x00    /* take the lesser of two in x dir */
  87. #define    RSLVE_Y_LESSER    0x00    /* take the lesser of two in y dir */
  88. #define    RSLVE_GREATER    (RSLVE_X_GREATER|RSLVE_Y_GREATER) /* > of 2 */
  89. #define    RSLVE_LESSER    (RSLVE_X_LESSER|RSLVE_Y_LESSER)      /* < of 2 */
  90.  
  91. /* What to do with slop */
  92. #define    SLOP_BITS    0xC0    /* bits defining what to do with slop */
  93. #define    SLOP_LEAVE    0x00    /* leave slop alone */
  94. #define    SLOP_EXPAND    0x40    /* expand to include slop */
  95. #define    SLOP_SHRINK    0x80    /* srink to discard slop */
  96.  
  97.  
  98. /* Function declarations */
  99.  
  100. #endif    /* _GRTEXTARRAY_H_ */
  101.